package com.wyh.controller.groupfour.admin;

import com.wyh.common.result.Result;
import com.wyh.domain.dto.groupfour.unifiedChargeDTO.AreceivableDetailDTO;
import com.wyh.domain.dto.groupfour.unifiedChargeDTO.UnifiedChargeDTO;
import com.wyh.domain.vo.gruopfour.threemeterVO.PageResult;
import com.wyh.domain.vo.gruopfour.unifiedChargeVO.*;
import com.wyh.service.appservice.UnifiedChargeService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;


@RestController
@RequestMapping("admin/unifiedCharge")
@Api(tags = "统一收费")
public class UnifiedChargeController {

    @Autowired
    private UnifiedChargeService unifiedChargeService;

    @ApiOperation("统一收费首页")
    @GetMapping
    public Result<PageResult<ChargeTargetVO>> getUnifiedCharge(UnifiedChargeDTO unifiedChargeDTO) {

        PageResult<ChargeTargetVO> unifiedCharge = unifiedChargeService.getUnifiedCharge(unifiedChargeDTO);
        return Result.success(unifiedCharge);
    }

    @ApiOperation("选择客户")
    @GetMapping("/selectCustomer")
    public Result<PageResult<SelectCustomerVO>> charge(@ApiParam("资源id") @RequestParam(value = "资源id") Integer resourceId, @RequestParam(defaultValue = "1") Integer pageNum, @RequestParam(defaultValue = "10") Integer pageSize) {

        PageResult<SelectCustomerVO> selectCustomerVOPageResult = unifiedChargeService.selectCustomer(resourceId, pageNum, pageSize);
        return Result.success(selectCustomerVOPageResult);
    }

    @ApiOperation("应收详情")
    @GetMapping("/receivableDetail")
    public Result<List<AreceivableVO>> receivableDetail(@ApiParam("客户id") @RequestParam(value = "客户id") Integer customerid) {

        List<AreceivableVO> receivableByCustomer = unifiedChargeService.getReceivableByCustomer(customerid);
        return Result.success(receivableByCustomer);
    }

    @ApiOperation("应收详情详细页")
    @PostMapping("/receivableDetailDetail")
    public Result<AreceivableSumVO> receivableDetailDetail(@RequestBody AreceivableDetailDTO areceivableDetailDTO) {

        AreceivableSumVO receivableDetailsInfo = unifiedChargeService.getReceivableDetailsInfo(areceivableDetailDTO);
        return Result.success(receivableDetailsInfo);
    }
//
//    @ApiOperation("查发票抬头")
//    @GetMapping("/invoiceheader")
//    public Result<PageResult<AreInvoiceHeaderVO>> invoiceheader(@ApiParam("客户id") @RequestParam(value = "客户id") Integer customerid, @RequestParam(defaultValue = "1") Integer pageNum, @RequestParam(defaultValue = "6") Integer pageSize) {
//        PageResult<AreInvoiceHeaderVO> invoiceheader = unifiedChargeService.getInvoiceheader(customerid, pageNum, pageSize);
//        return Result.success(invoiceheader);
//    }


}
